export default{
	state:{
		allData: [],
		appId: '',
		infoName: '',
		infoImg: '',
		infoGender: '',
		city: '',
		address: '暂未选择地址...',
		userInfo: [],
		hotData: ['车厘子','芒果','杨梅','水','菠萝'],
		collectData: []
	},
	getters:{
		getHotData(state){
			let arr = new Set(state.hotData)
			return Array.from(arr)
		},
		getHotDataLength(state){
			return state.hotData.length
		}
	},
	// 修改数据
	mutations:{
		// 收藏数据改变
		addCollect(state,item){
			state.collectData.push(item)
			let newCollectData = []
			state.collectData.map(item=>{
				if(item.collectStatus == true){
					newCollectData.push(item)
				}
			})
			state.collectData = newCollectData
		},
		reduceCollect(state,index){
			let allCollectData = state.collectData
			allCollectData[index].collectStatus = false
			allCollectData.splice(index,1)
		}
	}
}